.\" -*- nroff -*-
.\" Copyright (c) 2017 Mellanox Technologies, Inc.
.\" Licensed under the OpenIB.org (MIT) - See COPYING.md
.\"
.TH MLX4DV_INIT_OBJ 3 2017-02-02 1.0.0
.SH "NAME"
mlx4dv_init_obj \- Initialize mlx4 direct verbs object from ibv_xxx structures
.SH "SYNOPSIS"
.nf
.B #include <infiniband/mlx4dv.h>
.sp
.BI "int mlx4dv_init_obj(struct mlx4dv_obj *obj, uint64_t obj_type);
.fi
.SH "DESCRIPTION"
.B mlx4dv_init_obj()
This function will initialize mlx4dv_xxx structs based on supplied type. The information
for initialization is taken from ibv_xx structs supplied as part of input.

Request information of CQ marks its owned by direct verbs for all consumer index
related actions. The initialization type can be combination of several types together.
.PP
.nf
struct mlx4dv_qp {
.in +8
uint32_t         *rdb;
uint32_t         *sdb;
struct {
.in +8
uint32_t        wqe_cnt;
int             wqe_shift;
int             offset;
.in -8
} sq;
struct {
.in +8
uint32_t        wqe_cnt;
int             wqe_shift;
int             offset;
.in -8
} rq;
struct {
.in +8
void            *buf;
size_t          length;
.in -8
} buf;
uint64_t        comp_mask; /* Use enum mlx4dv_qp_comp_mask */
off_t           uar_mmap_offset; /* If MLX4DV_QP_MASK_UAR_MMAP_OFFSET is set in comp_mask, this will contain the mmap offset of *sdb* */
.in -8
};

struct mlx4dv_cq {
.in +8
struct {
.in +8
void            *buf;
size_t          length;
.in -8
} buf;
uint32_t        cqe_cnt;
uint32_t        cqn;
uint32_t        *set_ci_db;
uint32_t        *arm_db;
int             arm_sn;
int             cqe_size;
uint64_t        comp_mask; /* Use enum mlx4dv_cq_comp_mask */
void            *cq_uar;
.in -8
};

struct mlx4dv_srq {
.in +8
struct {
.in +8
void            *buf;
size_t          length;
.in -8
} buf;
int             wqe_shift;
int             head;
int             tail;
uint32_t        *db;
uint64_t        comp_mask;
.in -8
};

struct mlx4dv_rwq {
.in +8
__be32          *rdb;
struct {
.in +8
uint32_t        wqe_cnt;
int             wqe_shift;
int             offset;
.in -8
} rq;
struct {
.in +8
void            *buf;
size_t          length;
.in -8
} buf;
uint64_t        comp_mask;
.in -8
};

struct mlx4dv_obj {
.in +8
struct {
.in +8
struct ibv_qp      *in;
struct mlx4dv_qp   *out;
.in -8
} qp;
struct {
.in +8
struct ibv_cq      *in;
struct mlx4dv_cq   *out;
.in -8
} cq;
.in -8
};

enum mlx4dv_obj_type {
.in +8
MLX4DV_OBJ_QP   = 1 << 0,
MLX4DV_OBJ_CQ   = 1 << 1,
MLX4DV_OBJ_SRQ  = 1 << 2,
.in -8
};
.fi
.SH "RETURN VALUE"
0 on success or the value of errno on failure (which indicates the failure reason).
.SH "NOTES"
 * Compatibility masks (comp_mask) are in/out fields.
.SH "SEE ALSO"
.BR mlx4dv (7)
.SH "AUTHORS"
.TP
Maor Gottlieb <maorg@mellanox.com>
